GtkStyle*
_gtk_style_new_for_path (GdkScreen *screen,
- GtkWidgetPath *path)
+ GtkWidgetPath *path)
{
GtkStyleContext *context;
GtkStyle *style;
context = gtk_style_context_new ();
- gtk_style_context_set_screen (context, screen);
+
+ if (screen)
+ gtk_style_context_set_screen (context, screen);
gtk_style_context_set_path (context, path);
style = g_object_new (GTK_TYPE_STYLE,
path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
- style = _gtk_style_new_for_path (gdk_screen_get_default (),
- path);
+ style = _gtk_style_new_for_path (gdk_screen_get_default (), path);
gtk_widget_path_free (path);
G_CALLBACK (style_context_changed), widget);
gtk_style_context_set_screen (widget->priv->context,
- gtk_widget_get_screen (widget));
+ gtk_widget_get_screen_unchecked (widget));
_gtk_widget_update_path (widget);
gtk_style_context_set_path (widget->priv->context,
priv->has_user_ref_count = TRUE;
toplevel_list = g_slist_prepend (toplevel_list, window);
- g_signal_connect (priv->screen, "composited-changed",
- G_CALLBACK (gtk_window_on_composited_changed), window);
+ if (priv->screen)
+ g_signal_connect (priv->screen, "composited-changed",
+ G_CALLBACK (gtk_window_on_composited_changed), window);
}
static void
GtkWidget *widget;
GdkScreen *previous_screen;
gboolean was_mapped;
-
+
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (GDK_IS_SCREEN (screen));
gtk_widget_unmap (widget);
if (gtk_widget_get_realized (widget))
gtk_widget_unrealize (widget);
-
+
gtk_window_free_key_hash (window);
priv->screen = screen;
gtk_widget_reset_rc_styles (widget);
if (screen != previous_screen)
{
- g_signal_handlers_disconnect_by_func (previous_screen,
- gtk_window_on_composited_changed, window);
- g_signal_connect (screen, "composited-changed",
- G_CALLBACK (gtk_window_on_composited_changed), window);
-
+ if (previous_screen)
+ g_signal_handlers_disconnect_by_func (previous_screen,
+ gtk_window_on_composited_changed, window);
+ g_signal_connect (screen, "composited-changed",
+ G_CALLBACK (gtk_window_on_composited_changed), window);
+
_gtk_widget_propagate_screen_changed (widget, previous_screen);
_gtk_widget_propagate_composited_changed (widget);
}